home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 007a / pophits.zip / POPHITS.BAS < prev    next >
BASIC Source File  |  1988-09-14  |  11KB  |  362 lines

  1. DEFINT A-Y
  2. CONST false = 0, true = NOT false
  3. DECLARE SUB Painter ()
  4. DECLARE SUB TopOfPage (counts%, counta%, serch$)
  5. DECLARE SUB PrintLine (dat$, weeks%, title$, artist$, sinalb$, catgry$, counts%, counta%)
  6. DECLARE SUB EndOfPage (counts%, counta%)
  7. DECLARE FUNCTION IntIn% (y%, X%, mn%, mx%, length%)
  8. DECLARE FUNCTION OneInt% (y%, x%, mn%, mx%)
  9. DIM SHARED m$(10), np, ch, yn$
  10. DECLARE SUB center (whichline AS INTEGER, tl$)
  11. DECLARE SUB pulldwn1 (choice$(), choicenum!, leftmarg!, boxwid!)
  12.         choicemax = 5          'The max. number of choices in this example
  13.         leftmarg! = 20         'The left margin of the window
  14.         boxwid! = 34           'The desired width of the window
  15.         DIM choice$(choicemax)        'choicemax=max number of choices
  16.  
  17.         choice$(1) = "Search Database for Artist"
  18.         choice$(2) = "Search Database for Title"
  19.         choice$(3) = "Show Hits by Year"
  20.         choice$(4) = "Show Hits by Weeks at #1"
  21.         choice$(5) = "Quit to DOS"
  22. start:
  23. CALL Painter
  24. getkey:
  25.  
  26.  
  27.         CALL pulldwn1(choice$(), choicenum!, leftmarg!, boxwid!)
  28.         'The command, CALL, could be omitted if the sub is declared as above
  29.  
  30.         'Now, in this case, we display the choice selected.  It would
  31.         'normally be used in the main program.
  32. ON choicenum! GOTO arts, tits, year, week, quit
  33. GOTO start
  34. arts:
  35. RESET
  36. OPEN "pophits.del" FOR INPUT AS #1
  37.  
  38. COLOR 15, 4
  39. LOCATE 18, 16
  40. PRINT "█                                             █▓▓"
  41. LOCATE 19, 16
  42. PRINT "█     Enter a string for 'Artist' search:     █▓▓"
  43. LOCATE 20, 16
  44. PRINT "█                                             █▓▓"
  45. LOCATE 21, 16
  46. PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
  47. LOCATE 22, 18
  48. PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
  49. COLOR 14, 1
  50. LOCATE 20, 22
  51. INPUT "", artin$
  52. IF artin$ = "" THEN
  53.    GOTO start
  54.    END IF
  55. uartin$ = UCASE$(artin$)
  56. serch$ = "Searching for " + uartin$
  57. CALL TopOfPage(counts, counta, serch$)
  58. DO WHILE NOT EOF(1)
  59.    INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
  60.    uartist$ = UCASE$(artist$)
  61.    IF INSTR(uartist$, uartin$) THEN
  62.       CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
  63.    END IF
  64. LOOP
  65. CALL EndOfPage(counts, counta)
  66. GOTO start
  67.  
  68. tits:
  69. RESET
  70. OPEN "pophits.del" FOR INPUT AS #1
  71.      COLOR 15, 4
  72.      LOCATE 18, 16
  73.      PRINT "█                                             █▓▓"
  74.      LOCATE 19, 16
  75.      PRINT "█     Enter a string for 'Title' search:      █▓▓"
  76.      LOCATE 20, 16
  77.      PRINT "█                                             █▓▓"
  78.      LOCATE 21, 16
  79.      PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
  80.      LOCATE 22, 18
  81.      PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
  82.      COLOR 14, 1
  83. LOCATE 20, 22
  84. INPUT "", titin$
  85. IF titin$ = "" THEN
  86.    GOTO start
  87.    END IF
  88. utitin$ = UCASE$(titin$)
  89. serch$ = "Searching for " + utitin$
  90. CALL TopOfPage(counts, counta, serch$)
  91. DO WHILE NOT EOF(1)
  92.    INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
  93.    utitle$ = UCASE$(title$)
  94.    IF INSTR(utitle$, utitin$) THEN
  95.       CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
  96.    END IF
  97. LOOP
  98. CALL EndOfPage(counts, counta)
  99. GOTO start
  100. year:
  101. RESET
  102. OPEN "pophits.del" FOR INPUT AS #1
  103.      COLOR 15, 4
  104.      LOCATE 18, 16
  105.      PRINT "█                                             █▓▓"
  106.      LOCATE 19, 16
  107.      PRINT "█     Enter a year as 'YYYY' or 'YY':         █▓▓"
  108.      LOCATE 20, 16
  109.      PRINT "█                                             █▓▓"
  110.      LOCATE 21, 16
  111.      PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
  112.      LOCATE 22, 18
  113.      PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
  114.      COLOR 14, 1
  115. LOCATE 20, 22
  116. INPUT "", yerin$
  117. IF yerin$ = "" THEN
  118.    GOTO start
  119.    END IF
  120. serch$ = "Searching for " + yerin$
  121. CALL TopOfPage(counts, counta, serch$)
  122. DO WHILE NOT EOF(1)
  123.    INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
  124.    IF yerin$ = "19" + RIGHT$(dat$, 2) OR yerin$ = RIGHT$(dat$, 2) THEN
  125.       CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
  126.    END IF
  127. LOOP
  128. CALL EndOfPage(counts, counta)
  129. GOTO start
  130.  
  131. week:
  132. RESET
  133. OPEN "pophits.del" FOR INPUT AS #1
  134.      COLOR 15, 4
  135.      LOCATE 18, 16
  136.      PRINT "█                                             █▓▓"
  137.      LOCATE 19, 16
  138.      PRINT "█     Enter a range between 1 and 99:         █▓▓"
  139.      LOCATE 20, 16
  140.      PRINT "█                                             █▓▓"
  141.      LOCATE 21, 16
  142.      PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
  143.      LOCATE 22, 18
  144.      PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
  145.      COLOR 14, 1
  146. y% = 20
  147. X% = 22
  148. mn% = 1
  149. mx% = 99
  150. length% = 2
  151. wekin1% = IntIn%(y%, X%, mn%, mx%, length%)
  152. y% = 20
  153. X% = 28
  154. mn% = wekin1%
  155. mx% = 99
  156. length% = 2
  157. wekin2% = IntIn%(y%, X%, mn%, mx%, length%)
  158. serch$ = "Searching for " + STR$(wekin1%) + " through " + STR$(wekin2%) + " weeks"
  159. CALL TopOfPage(counts, counta, serch$)
  160. DO WHILE NOT EOF(1)
  161.    INPUT #1, dat$, weeks, title$, artist$, sinalb$, catgry$
  162.    IF wekin1% <= weeks AND wekin2% >= weeks THEN
  163.       CALL PrintLine(dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
  164.    END IF
  165. LOOP
  166. CALL EndOfPage(counts, counta)
  167. GOTO start
  168.  
  169. eoread:
  170. PRINT "ABEND  QB4 Error has occurred"
  171. quit:
  172. CLS
  173. END
  174.  
  175. SUB center (whichline, tl$)
  176.  'This is a simple routine that centers a string of text TL$
  177.  'on line number WHICHLINE. You can use it anywhere.
  178.  
  179.         tl = LEN(tl$)
  180.         tl = INT((80 - tl) / 2)
  181.         LOCATE whichline, tl
  182.         PRINT tl$;
  183.  
  184.  
  185. END SUB
  186.  
  187. SUB EndOfPage (counts, counta)
  188.     COLOR 14, 1
  189.     PRINT "Albums selected:"; counta; " Singles:"; counts
  190.     LOCATE 24, 20
  191.     INPUT "* Press Enter to continue *", xxx$
  192. END SUB
  193.  
  194. FUNCTION IntIn% (y%, X%, mn%, mx%, length%)
  195.    DO
  196.     COLOR 15, 4
  197.       temp$ = ""
  198.       LOCATE y%, X%: PRINT STRING$(length%, 176); : LOCATE y%, X%
  199.       DO
  200.          t$ = INPUT$(1)
  201.          IF t$ = CHR$(13) AND temp$ <> "" THEN
  202.             IF VAL(temp$) < mn% OR VAL(temp$) > mx% THEN
  203.                BEEP: EXIT DO
  204.             ELSE
  205.                PRINT STRING$(length% - LEN(temp$), 32);
  206.                frmt$ = STRING$(length%, "#") + ","
  207.                LOCATE y%, X%
  208.                PRINT USING frmt$; VAL(temp$);
  209.                IntIn% = VAL(temp$)
  210.                EXIT FUNCTION
  211.             END IF
  212.          ELSEIF t$ = CHR$(8) AND temp$ <> "" THEN
  213.             temp$ = LEFT$(temp$, LEN(temp$) - 1)
  214.             PRINT CHR$(29); CHR$(176); CHR$(29);
  215.          ELSEIF LEN(temp$) = length% THEN
  216.             BEEP
  217.          ELSEIF t$ < "0" OR t$ > "9" THEN
  218.             BEEP
  219.          ELSE
  220.             temp$ = temp$ + t$: PRINT t$;
  221.          END IF
  222.       LOOP
  223.    LOOP
  224. END FUNCTION
  225.  
  226. SUB Painter
  227.     VIEW PRINT 1 TO 25
  228.     COLOR 15, 1
  229.     CLS
  230.     COLOR 15, 0
  231.     LOCATE 2, 16
  232.     PRINT "█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█"
  233.     LOCATE 3, 16
  234.     PRINT "█                                             █▓▓"
  235.     LOCATE 4, 16
  236.     PRINT "█         Billboard #1 Hits Database          █▓▓"
  237.     LOCATE 4, 24
  238.     COLOR 31, 0
  239.     PRINT ""
  240.     LOCATE 4, 53
  241.     PRINT ""
  242.     COLOR 15, 0
  243.     LOCATE 5, 16
  244.     PRINT "█                                             █▓▓"
  245.     LOCATE 6, 16
  246.     PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
  247.     LOCATE 7, 18
  248.     PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
  249.     COLOR 15, 4
  250.     LOCATE 10, 16
  251.     PRINT "█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ Menu ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█"
  252.     LOCATE 11, 16
  253.     PRINT "█                                             █▓▓"
  254.     LOCATE 12, 16
  255.     PRINT "█                                             █▓▓"
  256.     LOCATE 13, 16
  257.     PRINT "█                                             █▓▓"
  258.     LOCATE 14, 16
  259.     PRINT "█                                             █▓▓"
  260.     LOCATE 15, 16
  261.     PRINT "█                                             █▓▓"
  262.     LOCATE 16, 16
  263.     PRINT "█                                             █▓▓"
  264.     LOCATE 17, 16
  265.     PRINT "█                                             █▓▓"
  266.     LOCATE 18, 16
  267.     PRINT "█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█▓▓"
  268.     LOCATE 19, 18
  269.     PRINT "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
  270.     COLOR 14, 1
  271. END SUB
  272.  
  273. SUB PrintLine (dat$, weeks, title$, artist$, sinalb$, catgry$, counts, counta)
  274.     IF sinalb$ = "a" THEN
  275.        COLOR 15, 1
  276.        type$ = "Album"
  277.        counta = counta + 1
  278.     END IF
  279.     IF sinalb$ = "s" THEN
  280.        COLOR 11, 1
  281.        type$ = "Single"
  282.        counts = counts + 1
  283.     END IF
  284.     PRINT type$; TAB(8);
  285.     PRINT USING "##"; weeks,
  286.     PRINT TAB(11); artist$; TAB(31); title$; TAB(71); dat$
  287.     IF CSRLIN >= 23 THEN
  288.        COLOR 14, 1
  289.        LOCATE 24, 20
  290.        INPUT "* Press Enter to continue *", xxx$
  291.        CLS
  292.        END IF
  293. END SUB
  294.  
  295. SUB TopOfPage (counts, counta, serch$)
  296.     counta = 0
  297.     counts = 0
  298.     COLOR 14, 1
  299.     CLS
  300.     PRINT serch$
  301.     PRINT "Type Weeks     Artist                 Title                             Date"
  302.     VIEW PRINT 3 TO 25
  303. END SUB
  304.  
  305. ' (c) 1987 by Paul M. Friedman
  306. FUNCTION OneInt% (y%, x%, mn%, mx%)
  307.    temp$ = ""
  308.    WHILE temp$ = "" OR VAL(temp$) < mn% OR VAL(temp$) > mx%
  309.       temp$ = INPUT$(1)
  310.       IF temp$ < "0" OR temp$ > "9" THEN
  311.             BEEP: temp$ = ""
  312.          ELSEIF VAL(temp$) < mn% OR VAL(temp$) > mx% THEN
  313.             BEEP: temp$ = ""
  314.       END IF
  315.       OneInt% = VAL(temp$)
  316.    WEND
  317. END FUNCTION
  318.  
  319.  
  320. SUB pulldwn1 (choice$(), choicenum!, leftmarg!, boxwid!) STATIC
  321. ' This procedure will return the selected choice number as choicenum
  322.      numchoice = UBOUND(choice$) 'this array should have been dimensioned
  323.                               'to max number of choices
  324.      'Draw a box
  325. 'initial screen
  326.      LOCATE 12, (leftmarg! + 5): COLOR 4, 7: PRINT "1  " + choice$(1): COLOR 15,4
  327.      FOR n = 1 TO (numchoice - 1)
  328.           LOCATE (12 + n), (leftmarg! + 5)
  329.           PRINT CHR$(49 + n) + "  " + choice$(n + 1)
  330.      NEXT n
  331.  
  332.      DO
  333.           WHILE g = 0
  334.           x$ = INKEY$
  335.           IF x$ <> "" THEN g = 1
  336.           WEND: g = 0
  337.  
  338.           IF LEN(x$) = 2 THEN x$ = RIGHT$(x$, 1): mark = 1  'extended code
  339.           IF mark AND ASC(x$) = 72 AND down > 0 THEN down = down - 1: mark = 0
  340.           IF mark AND ASC(x$) = 72 AND down = 0 THEN down = numchoice - 1: mark = 0
  341.           IF mark AND ASC(x$) = 80 AND down < (numchoice - 1) THEN down = down + 1: mark = 0
  342.           IF mark AND ASC(x$) = 80 AND down = (numchoice - 1) THEN down = 0: mark = 0
  343.  
  344.           FOR n = 0 TO (numchoice - 1)
  345.                IF down = n THEN
  346.                     LOCATE (12 + n), (leftmarg! + 5): COLOR 4,7
  347.                     PRINT CHR$(49 + n) + "  " + choice$(n + 1): COLOR 15,4
  348.                ELSE
  349.                     LOCATE (12 + n), (leftmarg! + 5)
  350.                     PRINT CHR$(49 + n) + "  " + choice$(n + 1)
  351.                END IF
  352.           NEXT n
  353.  
  354.           FOR n = 1 TO numchoice
  355.                IF x$ = CHR$(48 + n) THEN down = n - 1: x$ = CHR$(13)
  356.           NEXT n
  357.  
  358.           LOOP WHILE x$ <> CHR$(13)
  359.           choicenum! = down + 1: down = 0
  360. END SUB
  361.  
  362.